package cn.gzjp.modules.gas.service;

import java.util.List;

import cn.gzjp.modules.dt.entity.Question;
import cn.gzjp.modules.dt.entity.QuestionOption;
import cn.gzjp.modules.dt.service.QuestionOptionService;
import cn.gzjp.modules.gas.entity.GasGun;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.gzjp.common.persistence.Page;
import cn.gzjp.common.service.CrudService;
import cn.gzjp.modules.gas.entity.GasStation;
import cn.gzjp.modules.gas.dao.GasStationDao;

/**
 * 加油站管理Service
 * @author zengcp
 * @version 2018-03-05
 */
@Service
@Transactional(readOnly = true)
public class GasStationService extends CrudService<GasStationDao, GasStation> {
	@Autowired
	private GasGunService gasGunService;

	public GasStation get(String id) {
		GasStation gasStation =  super.get(id);
		GasGun search = new GasGun();
		search.setStationId(id);
		gasStation.setGunList(gasGunService.findList(search));
		return gasStation;

	}


	public List<GasStation> findList(GasStation gasStation) {
		return super.findList(gasStation);
	}
	
	public Page<GasStation> findPage(Page<GasStation> page, GasStation gasStation) {
		return super.findPage(page, gasStation);
	}
	
	@Transactional(readOnly = false)
	public void save(GasStation gasStation) {
		super.save(gasStation);
	}
	
	@Transactional(readOnly = false)
	public void delete(GasStation gasStation) {
		super.deleteByLogic(gasStation);
	}
	
}